package action.student;

import dao.Student;
import java.io.IOException;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class deleteStudentinClass extends HttpServlet {

    protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException {
        String acc_id = request.getParameter("acc_id");
        String class_id = request.getParameter("class_id");
        Student st = new Student();
        String msg = "";
        String error = "";
        if (st.deleteStudent(acc_id, class_id)) {
            msg = "Delete successful !";
        } else {
            error = "Delete fail !";
        }
        request.setAttribute("msg", msg);
        request.setAttribute("error", error);
        request.setAttribute("class_id", class_id);
        request.setAttribute("command", "deleteSt");
        RequestDispatcher rd = request.getRequestDispatcher("index.jsp?page=account");
        rd.forward(request, response);
    }
}
